package com.endpoint.controller;

import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpoint;

@WebEndpoint(id = "webEndpointCustom")
public class WebEndpointCustom {

    /*
    EndPoint的三种请求方式：
        @ReadOperation	    GET
        @WriteOperation	    POST
        @DeleteOperation	DELETE
     */

    //CURL -X http://localhost:8080/actuator/endpointCustom?content=zhangconglong
    @ReadOperation
    public String webRead(String content) {
        return "webEndpoint 读取内容: " + content;
    }

    @WriteOperation
    public String webWrite(String content) {
        return "webEndpoint 写内容: " + content;
    }

    @DeleteOperation
    public String webDelete(String content) {
        return "webEndpoint 删除内容: " + content;
    }

}